package cls.inner;

/**
 * @author mubei
 * @date 2021/12/21
 * @description
 */
public class MemberInnerClass {
    public static void main(String[] args) {
        Outer03 outer03 = new Outer03();

        // 创建成员内部类
        Outer03.Inner03 inner = outer03.new Inner03();
        inner.say();
        // 使用方法创建
        Outer03.Inner03 inner03 = outer03.user();

        // 直接创建
        Outer03.Inner03 inner31 = new Outer03().new Inner03();

    }
}

class Outer03 {
    private int i = 10;

    class Inner03 {
        public void say(){
            System.out.println("我是成员内部类"+i);
        }
    }

    public Inner03 user(){
        System.out.println("类创建成员内部类");
        Inner03 inner03 = new Inner03();
        inner03.say();
        return inner03;
    }

}
